﻿using System;
using System.Collections.Generic;

using E.BLL;
using E.Model;
using E.Web.UI.Page;

using X.Common;

namespace E.Web.Teacher.info
{
    public partial class SafetyInfo : TeacherBasePage
    {
        public IDictionary<int, string> questionList;
        public PwdQuestionModel qm;

        protected override void ShowPage()
        {
            TeacherBLL bll = new TeacherBLL();
            questionList = bll.GetForgetPwdQuestionList();
            qm = bll.GetForgetPwdQuestionID(teacherid);

            if (ispost)
            {
                int questionid = XRequest.GetInt("QuestionSlt", -1);
                string answer = XRequest.GetString("AnswerTxt");
                if (questionid != -1 && !answer.Equals(""))
                {
                    PwdQuestionModel model = new PwdQuestionModel();
                    model.ID = questionid;
                    model.TeacherID = teacherid;
                    model.Answer = answer;
                    int rst = bll.UpdateFortgetPwdInfo(model);
                    if (rst > 0)
                    {
                        ExecuteJS("alert('更新成功'); window.location.replace('/info/SafetyInfo.aspx');");
                    }
                    else
                    {
                        Alert("更新失败");
                    }
                }
                else
                {
                    Alert("信息填写错误");
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
